app.controller('baseController',function($scope){
    //分页控件配置信息
    $scope.paginationConf = {
        currentPage : 1,//当前页码
        totalItems : 10,//总记录数
        itemsPerPage : 10,//每页的记录数
        perPageOptions : [10,20,30,40,50],//可选择的每页分页记录数
        onChange : function(){
            $scope.reloadList();//重新加载
        }
    }
    //刷新列表
    $scope.reloadList = function(){
        $scope.search($scope.paginationConf.currentPage,$scope.paginationConf.itemsPerPage);
    }

    //定义列表选中编号数组
    $scope.selectIds = [];

    //添加选中的编号加入定义的编号数组中
    $scope.selectionIds = function($event,id){
        if($event.target.checked){
            $scope.selectIds.push(id);
        }else{
            var index = $scope.selectIds.indexOf(id);
            $scope.selectIds.splice(index,1);
        }
    }

    $scope.jsonToString = function (jsonString,key) {
        var json = JSON.parse(jsonString);
        var value = "";
        for(var i = 0;i<json.length;i++){
            if(i>0){
                value += ",";
            }
            value += json[i][key];
        }
        return value;
    }
});